﻿using Common.Attributes;
using QGZX.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace QGZX.Logic.Admin
{
    public class PositionApplyController : Controller
    {
        /// <summary>
        /// PositionApply +加载视图index()方法
        /// </summary>
        /// <returns></returns>
        public ActionResult index()
        {
            return View();

        }
       
        #region 获取岗位申请表学生数据+GetPosApplyStuData（）

        [HttpPost]
        [AjaxRequest]
        /// <summary>
        /// 获取岗位申请表学生数据+GetPosApplyStuData（）
        /// </summary>
        /// <returns></returns>

        public ActionResult GetPosApplyStuData()
        {
            //获取页容量
            int pageSize = int.Parse(Request.Form["rows"]);
            //获取请求页码
            int pageIndex = int.Parse(Request.Form["page"]);
            var list = OperateContext.Current.BLLSession.Iqgzx_position_applicationBLL.GetPagedList(pageIndex, pageSize, x => x.PosApplyId != null, m => m.PosApplyId).Select(x => x.ToPOCO());
            int rowCount = OperateContext.Current.BLLSession.Iqgzx_position_applicationBLL.GetListBy(x => x.PosApplyId != null).Count();
            //return OperateContext.Current.RedirectAjax("ok", "加载成功", list, "");
            MODEL.EasyUIModel.DataGridModel dgMode = new MODEL.EasyUIModel.DataGridModel()
            {
                total = rowCount,
                rows = list,
                footer = null
            };
            return Json(dgMode);
        } 
        #endregion
    }
}
